package com.ruoyi.useComponent;

import lombok.Data;
import org.quartz.Trigger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/**
 * @program: RuoYi
 * @description: 测试
 * @author: yanghua
 * @create: 2021-07-29 17:47
 **/
@Configuration
public class TestStudent {

    @Bean(name = "serviceBeanSync")
    public MethodInvokingJobDetailFactoryBean serviceBeanSync(Student student) {
        student.eat();
        MethodInvokingJobDetailFactoryBean jobDetail = new MethodInvokingJobDetailFactoryBean();
        // 是否并发执行
        jobDetail.setConcurrent(false);
        // 需要执行的实体bean
        jobDetail.setTargetObject(student);
        // 需要执行的方法
        jobDetail.setTargetMethod("eat");

        return jobDetail;
    }

}
